<template>
  <svg
      :class="['svg-icon', $attrs.class]"
      :style="{width: width + 'px', height: height + 'px',}"
      aria-hidden="true"
  >
    <use :xlink:href="'#icon-' + name" :fill="color"/>
  </svg>
</template>

<script>
import {defineComponent} from 'vue'

export default defineComponent({
  name: 'SvgIcon',
  props: {
    name: {
      type: String,
      required: true,
    },
    // svg 宽度
    width: {
      type: String,
      default: '16px'
    },
    // svg 高度
    height: {
      type: String,
      default: '16px'
    },
    // svg图标的颜色
    color: {
      type: String,
      default: ''
    },
  },
  setup() {
    return {}
  },
})
</script>

<style scoped>
.svg-icon {
  fill: currentColor;
  vertical-align: middle;
}
</style>
